<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改房源</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="{{asset('layui/css/layui.css')}}" media="all">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script type="text/javascript" src="{{asset('Jquery/jquery-3.3.1.js')}}"></script>
</head>
<body>
<script src="{{asset('layui/layui.js')}}"></script>
<form  class="layui-form" action="{{url('updateHousing')}}" method="post">
    @csrf
    <input type="hidden" name="housing_id" value="{{$editHousing->id}}">
    <table class="layui-table">
        <thead>
        <tr>
            <th colspan="4" style="font-size: 18px;text-align: center;color:#666666">修改房源</th>
        </tr>
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px;width: 150px">
                <label >所属项目:</label>
            </th>

            <th style="width: 400px" colspan="3">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <select name="project_id" lay-filter="aihao" >
                            <option value="">请选择所属项目名称</option>
                            @foreach($allProject as $k=>$project)
                                <option value="{{$project->id}}" @if($project->id==old('project_id')) selected @endif>{{$project->name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                </div>

                @if($errors->has('project_id'))
                    <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('project_id')}}</sapn></span>
                @endif

            </th>
        </tr>--}}
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>户主姓名:</label></th>
            <th colspan="3">
                <div>
                    <input type="text" name="householder" required  value="{{$editHousing->householder}}" lay-verify="required" placeholder="请输入户主姓名，如：张三" autocomplete="off" class="layui-input" style="width:400px; height:30px;">
                </div>
                <div>
                    @if($errors->has('householder'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('householder')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>区块名称:</label></th>
            <th colspan="3">
                <div>
                    <input type="text" name="block_name" required  value="{{$editHousing->block_name}}" lay-verify="required" placeholder="请输入区块名称，如：王家村" autocomplete="off" class="layui-input" style="width:400px; height:30px;">
                </div>
                <div>
                    @if($errors->has('block_name'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('block_name')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>小区名称:</label></th>
            <th colspan="3">
                <div>
                    <input type="text" name="housing_name" required  value="{{$editHousing->housing_name}}" lay-verify="required" placeholder="请输入小区名称，如：皇苑雅亭小区" autocomplete="off" class="layui-input" style="width:400px; height:30px;">
                </div>
                <div>
                    @if($errors->has('housing_name'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('housing_name')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px">
                <label>栋号:</label>
            </th>
            <th colspan="3">
                <div>
                    <input type="text" name="housing_number" required  lay-verify="required" value="{{$editHousing->housing_number}}" placeholder="请输入栋号，如：A栋1单元" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('housing_number'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('housing_number')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <div >
                <th style="text-align: center;color:#666666;font-size: 14px">
                    <label >房号:</label>
                </th>
                <th style="text-align: center">
                    <div>
                        <input type="text" name="room_number" required  value="{{$editHousing->room_number}}" lay-verify="required" placeholder="请输入房号，如：3301" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                    </div>
                    <div>
                        @if($errors->has('room_number'))
                            <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('room_number')}}</sapn></span>
                        @endif
                    </div>
                </th>
            </div>
        </tr>
        <tr>
            <div >
                <th style="text-align: center;color:#666666;font-size: 14px">
                    <label >楼层:</label>
                </th>
                <th style="text-align: center">
                    <div>
                        <input type="text" name="floor_number" required  value="{{$editHousing->floor_number}}" lay-verify="required" placeholder="请输入楼层，如：16层，直接输16" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                    </div>
                    <div>
                        @if($errors->has('floor_number'))
                            <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('floor_number')}}</sapn></span>
                        @endif
                    </div>
                </th>
            </div>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>面积（㎡）：</label></th>
            <th>
                <div>
                    <input type="text" name="area" required  value="{{$editHousing->area}}" lay-verify="required" placeholder="请输入面积，如：135.8㎡，直接输135.8" autocomplete="off" class="layui-input" style="width:450px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('actuator'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('actuator')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label >交房时间：</label></th>
            <th>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="house_deliver_time" id="test23" placeholder="" value="{{$editHousing->house_deliver_time}}">
                    </div>
                </div>
            </th>
        </tr>
        <tr>
            <th colspan="4" style="color:deeppink;font-size: 25px;text-align: center">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="">确认修改</button>
                    </div>
                </div>
            </th>
        </tr>
        </div>
        </thead>
    </table>
    <div class="layui-form-item"><input type="hidden" id="promptMessage" name="promptMessage" value="{{Session::get('status')}}"></div>
</form>
</div>
{{--添加成功后的提示信息--}}
<script>
    layui.use(['layer'],function(){
        var layer=layui.layer;
        var msg=$("#promptMessage").val();
        if(msg!=""){
            layer.msg(msg);
        }
    });
</script>
{{--监听--}}
<script>
    $(function () {
        layui.use('form', function () {
            var $ = layui.jquery;
            var form = layui.form; //Tab的切换功能，切换事件监听等，需要依赖element模块
            form.on('select()', function(data){
                $("#videoNum").empty();
                var videoId=$("#changeVideo option:selected").val()
                var url="{{url('getVideoNum')}}";
                $.ajax({
                    url:url,
                    type:'POST',
                    data:{'videoId':videoId,'_token':"{{csrf_token()}}"},
                    success:function(response){
                        $("#videoNum").empty();
                        $("#videoNum").append(response);


                    }

                });
            });

        });

    });

</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //只出现确定按钮
        laydate.render({
            elem: '#test23'
            ,btns: ['confirm']
        });
    })
</script>
{{--视频上传--}}
<script>

    layui.use('upload', function(){
        var upload = layui.upload;
        /*视频上传*/
        $(function () {
            var uploadInst = upload.render({
                elem: '#videos' //绑定元素
                ,field:'vid'
                ,accept:'video'
                ,acceptMime:'video/mkv'
                ,exts:'mkv|avi|wmv|mp4|rmvb|3gp|mov|avm|flv|m4v'
                ,size:1024*1024*10
                ,url: '/api/uploadVideo' //上传接口
                ,before: function(obj){
                    layer.load();
                }
                ,done: function(res){
                    layer.closeAll('loading'); //关闭loading
                    if(res.msg==1){
                        layer.msg('小主，影片上传成功哦！', {icon: 6});
                        $("#vid_url").val(res.url);
                        $('#tipMsg').text('(成功)');
                    }
                    //上传完毕回调
                }
                ,error: function(error){
                    layer.closeAll('loading'); //关闭loading
                    //请求异常回调
                    if(error.msg==0){
                        layer.msg('小主，影片上传失败啦！', {icon: 2});
                        $('#tipMsg').text('(失败)');
                    }
                }
            });
        });
    });

</script>
</body>
</html>